import React from 'react'

import { Head } from 'next/document'

const screenAdaptation = `
    (function (doc, win) {
        var docEl = doc.documentElement,
            resizeEvt = 'onorientationchange' in window ? '' : 'resize',
            recalc = function () {
                var clientWidth = docEl.clientWidth;
                if (!clientWidth) return;
                if(clientWidth>=800){
                    docEl.style.fontSize = '100px';
                }else{
                    docEl.style.fontSize = 100 * (clientWidth / 720) + 'px';
                }
            };
        if (!doc.addEventListener) return;
        win.addEventListener(resizeEvt, recalc, false);
        try{
            recalc();
        }catch(e){
            console.log(e)
        }
    })(document, window);
`

export default () => (<Head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="full-screen" content="yes" />
    <meta name="x5-fullscreen" content="yes" />
    <title>92, 拍出你的故事</title>
    <style>{`
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
    `}</style>
    <script dangerouslySetInnerHTML={{ __html: screenAdaptation }} />
</Head>)

